<?php
//session handling
session_write_close();
// Get these from http://developers.facebook.com
$api_key = 'facebook application api key';
$secret  = 'facebook application secret key';


$facebookuser = $_POST['fb_sig_user'];
if (!$facebookuser)
  $facebookuser = $_GET['fb_sig_user'];

  $prefix = ($facebookuser) ? 'fb_sig' : $api_key;
  $key = $prefix . '_session_key';

  if( isset($_REQUEST[$key]) && $facebookuser){
    $session_key =   $_REQUEST[$key];

    session_name( $session_key );
    session_id( $facebookuser );
    session_start();


  } else {
    // Just so there *is* a session for times when there is no fb session
    session_start();
    $session_key = session_id();
  }


// the facebook client library
include_once 'client/facebook.php';

?>
